package dsx.macro;

import java.util.Date;

public class DateTool {

    public static final int Earlier = -1;
    public static final int Same = 0;
    public static final int Later = 1;

    // 返回值含义：-1 date1在前；0 相同；1 date2在前
    public static int compare(Date date1, Date date2) {
        if (date1 == null && date2 == null)
            return 0;
        if (date1 == null)
            return -1;
        if (date2 == null)
            return 1;
        if (date1.before(date2))
            return -1;
        if (date1.after(date2))
            return 1;
        return 0;
    }

}
